import request from "../request.js";

/**
 * 获取所有订单
 */
function findAllOrders() {
	return request({
		url: '/lejuClient/order/findAllOrders',
	});
}

/**
 * 分页获取订单
 * @param {Object} start
 * @param {Object} limit
 */
function findOrdersByPage(start, limit) {
	return request({
		url: `/lejuClient/order/findOrdersByPage/${start}/${limit}`
	});
}

/**
 * 获取所有退单
 */
function orderReturnApplys() {
	return request({
		url: "/lejuClient/orderReturn/orderReturnApplys"
	});
}

/**
 * 取消订单
 * @param {Object} orderId 订单id
 */

function cancelOrder(orderId) {
	return request({
		url: `/lejuClient/order/cancelOrder/${orderId}`,
		method: 'POST'
	});
}

/**
 * 确认收货
 * @param {Object} data
 */
function receiveDone(data) {
	return request({
		url: `/lejuClient/order/receiveDone`,
		method: 'POST',
		data
	});
}

/**
 * 删除订单
 * @param {Object} orderId
 */
function deleteOrder(orderId) {
	return request({
		url: `/lejuClient/order/deleteOrder/${orderId}`,
		method: 'DELETE'
	});
}

export {
	findAllOrders,
	findOrdersByPage,
	orderReturnApplys,
	cancelOrder,
	receiveDone,
	deleteOrder
}
